package com.yeqian.system.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeqian.vo.PageVO;
import com.yeqian.system.entity.SystemConfig;
import com.yeqian.system.mapper.SystemConfigMapper;
import com.yeqian.system.service.SystemConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 系统配置服务层
 */
@Service
public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, SystemConfig> implements SystemConfigService {

    @Resource
    private SystemConfigMapper systemConfigMapper;

    /**
     * 查询系统配置列表
     *
     * @param pageVO
     * @return
     */
    @Override
    public PageInfo<SystemConfig> listSystemConfig(PageVO pageVO) {
        PageHelper.startPage(pageVO.getPageNum(), pageVO.getPageSize());
        QueryWrapper<SystemConfig> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("deleteFlag", 0);
        queryWrapper.orderByAsc("porder");
        List<SystemConfig> systemConfigList = systemConfigMapper.selectList(queryWrapper);
        return PageInfo.of(systemConfigList);
    }
}
